package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import model.Department;

public class DepartmentDao {

	public List<Department> selectAll(String sql, List params) {
		// TODO 自动生成的方法存根
		List<Department> list=new ArrayList<>();
		ResultSet rSet=JDBCUtil.execQuery(sql, params);
		Department department;
		try {
			while (rSet.next()) {
				department=new Department();
				department.setDepartmentid(rSet.getInt(1));
				department.setDepartmentname(rSet.getString(2));
				list.add(department);
			}
		} catch (SQLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
		return list;
	}

}
